<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
          width: 200px;
          height: 200px;
          line-height: 200px;
          background-color: antiquewhite;
          color: brown;
          font-size: 50px;  
          font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
          margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <center>
        <div id="sno">1</div>
        <button onclick="start()">开始</button>
        <button onclick="stop()">结束</button>
    </center>
   
    <script>
        //定时器
        var timer ;
        function start(){
            //生成随机数
            var num = getRandomIntInclusive(1,44);
            //将内容显示在div中
            document.getElementById('sno').innerHTML = num;
            //周期调用
            timer = setTimeout('start()',50);
        }
        function stop(){
            //清除定时器
            clearTimeout(timer);
        }
        //随机数函数
        function getRandomIntInclusive(min, max) {
            const minCeiled = Math.ceil(min);
            const maxFloored = Math.floor(max);
            return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled); 
        }
        
    </script>
</body>
</html>